import request from "@/utils/request";

//分类列表的每一项的类型
export interface categoryItemType {
  id: number;
  name: string;
  category1Id?: number;
  category2Id?: number;
}

//分类列表的类型
export type categoryListType = categoryItemType[];

//1. 一级分类列表请求
export const reqCategort1List = () => {
  return request.get<null, categoryListType>(`/admin/product/getCategory1`);
};

//2. 二级分类列表请求
export const reqCategort2List = (category1Id: number) => {
  return request.get<null, categoryListType>(
    `/admin/product/getCategory2/${category1Id}`
  );
};

//3. 三级分类列表请求
export const reqCategort3List = (category2Id: number) => {
  return request.get<null, categoryListType>(
    `/admin/product/getCategory3/${category2Id}`
  );
};
